
#ifndef _CAR_CTRL_H
#define _CAR_CTRL_H

/*
	Q0, Q1 -> FL motor 
	Q2, Q3 -> FR motor
	Q4, Q5 -> BL motor
	Q6, Q7 -> BR motor
*/

#define CAR_DIR_LEFT	1
#define CAR_DIR_RIGHT	2
#define CAR_DIR_UP		3
#define CAR_DIR_DOWN	4
#define CAR_DIR_NONE	0

class CarCtrl
{
public:
	CarCtrl(int PIN_FL_EN, int PIN_FR_EN, int PIN_BL_EN, int PIN_BR_EN, int PIN_Data, int PIN_Latch, int PIN_Clock);
	~CarCtrl();

	void Start();

	void SetStatus(String info); // Format: FL(speed,dir);FR(speed,dir);BL(speed,dir);BR(speed,dir)

	void SetDirSpeed( int dir, int speed);

	void Speed(int speed);

	void Forward();
	void Back();
	void TurnLeft();
	void TurnRight();
	void Brake();
	void Relase();

private:
	void SetMotorStatus(String status);

private:
	int mPE_FL;
	int mPE_FR;
	int mPE_BL;
	int mPE_BR;
	int mPLatch;
	int mPClock;
	int mPData;

	int mSpeed;

	int mStatus;
};


#endif